package com.example.mountainwalker.service.impl;



import com.example.mountainwalker.entity.ManagerInfo;
import com.example.mountainwalker.mapper.ManagerMapper;
import com.example.mountainwalker.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ManagerServiceImpl implements ManagerService {
    @Autowired
    private ManagerMapper managerMapper;

    @Override
    public List<ManagerInfo> getManagerInfo() {
        return managerMapper.getManagerInfo();
    }

    @Override
    public ManagerInfo getManagerInfoById(Integer id) {
        return managerMapper.getManagerInfoById(id);
    }

    @Override
    public int deleteManagerInfoById(Integer id) {
        return managerMapper.deleteManagerInfoById(id);
    }

    @Override
    public int insertManagerInfo(ManagerInfo managerInfo) {
        return managerMapper.insertManagerInfo(managerInfo);
    }

    @Override
    public boolean validateManager(String adminName, String adminPassword) {
        ManagerInfo manager = managerMapper.getManagerInfoByName(adminName);
        return manager != null && manager.getAdminPassword().equals(adminPassword);
    }

}
